/*  ----------------------------------------------------------------------------
 *  Arello Mobile
 *  Fast 3d Engine
 *  ----------------------------------------------------------------------------
 * Except where otherwise noted, this work is licensed under
 * http://creativecommons.org/licenses/by/3.0
 */

#include <Win32/win32.h>
#include "../filesystem.h"

namespace liba
{

namespace filesystem
{

bool copy(const filesystem::String & from, const filesystem::String & to, bool overwrite_if_exists)
{
	return CopyFile( from.c_str(), to.c_str(), !overwrite_if_exists ) != 0;
}

bool del(const filesystem::String & file_name)
{
	return DeleteFile(file_name.c_str());
}

bool create_directory_tree(const filesystem::String & path)
{
	filesystem::String::iterator cit = path.begin();
	if( cit == path.end() )
		return true;
	filesystem::String part = *cit++;
	while( cit != path.end() )
	{
		CreateDirectory( part.c_str(), 0 );
		part += "\\";
		part += *cit++;
	}
	return true;
}

}//end of namespace filesystem

}//end of namespace liba

